<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class molten_chat_module
	{
		/*  --|-- ----- ----- ----- -----|----- ----- ----- ----- --|-- //
		// Name: initiate
		// Title: Initiate module.
		// Variables: None.
		// Description: Load required files, and setup proper data for use within phpBB 3.
		// --|-- ----- ----- ----- -----|----- ----- ----- ----- --|-- */
		public static function initiate ()
			{

			}

		/* --|-- ----- ----- ----- -----|----- ----- ----- ----- --|-- //
		// Name: parse_link
		// Title: Parse a local link.
		// Variables: $link
		//	1.	$link: The link to parse.
		// Description: Add arguments designed to maintain sessions on phpBB 3.
		// --|-- ----- ----- ----- -----|----- ----- ----- ----- --|-- */
		public static function parse_link ($link)
			{
				global $phpbb_root_path;

				// Get the location of the question mark.
				$index = strpos ($link, '?');

				// Get the arguments (which come after the question mark). Example: f=8&t=12
				$arguments = ($index !== false) ?
					substr ($link, ($index + 1)) :
					false;

				// Get the base link.  Example: viewtopic.php
				$link = ($index !== false) ?
					substr ($link, 0, $index) :
					$link;

				// Run the built-in phpBB 3 function: append_sid to add any local user data to it.
				$link = append_sid ($phpbb_root_path . $link, $arguments, false);

				return $link;
			}
	}

// Include database.
require (molten_chat_include . 'database/molten_chat_database_' . molten_chat_server :: $configuration ['database'] . '.php');
?>
